#include<iostream>
using namespace std;
void test()
{
	string s1("https://www.lanqiao.cn/users/2598356/?tab=1&lq_cup_tab=1");
	string sub1, sub2, sub3;
	size_t pos1 = s1.find(':');
	sub1 = s1.substr(0, pos1);
	cout << sub1 << endl;
	size_t pos2 = s1.find('/',pos1+3);
	//cout << *(s1.begin() + pos2) << endl;
	sub2 = s1.substr(pos1 + 3, pos2 - pos1 - 3);
	cout << sub2 << endl;
	pos1 = s1.rfind('/');
	if (pos1 + 1 != s1.size())
	{
		sub3 = s1.substr(pos1);
		cout << sub3 << endl;
	}
	else
	{
		pos2 = 0;
		while (pos1 != s1.find('/', pos2))
		{
			pos2 = s1.find('/', pos2 + 1);
			++pos2;
		}
		sub3 = s1.substr(pos2, pos1 - pos2);
		cout << sub3 << endl;
	}

}


bool isalp(char ch)
{
	return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
}
string reverseOnlyLetters(string s)
{
	size_t left = 0, right = s.size() - 1;
	while (right > left)
	{
		while (!isalp(s[left]))
		{
			++left;
		}
		while (!isalp(s[right]))
		{
			--right;
		}
		swap(s[left++], s[right--]);
	}
	return s;
}
void test1()
{
	string s1("7_28]");
	string s2 = reverseOnlyLetters(s1);
	cout << s2 << endl;
}
int main()
{
	test1();
	return 0;
}


